import { http } from "@/utils/http";
import { baseUrlApi, filerEmptyVal } from "../utils";

/** 列表查询 */
export const getCrossStoreOrderList = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/crossStoreSuborderOrder/page"), {
    params: filerEmptyVal(params)
  });
};

/** 待确认列表查询 */
export const getCrossStoreConfirmOrderList = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/crossStoreSuborderOrder/to/be/page"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 根据门店id查询仓库 */
export const getDepositoryByStoreId = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/crossStoreSuborderOrder/getDepositoryByStoreId"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 门店库存列表 */
export const getGoodsBystore = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/crossStoreSuborderOrder/store/stock/page"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 数量统计 */
export const getCrossStoreOrderSum = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/crossStoreSuborderOrder/state/quantity/statistics"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 新增 */
export const addCrossStoreOrder = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/crossStoreSuborderOrder/add"), {
    data: filerEmptyVal(data)
  });
};

/** 详情 */
export const getCrossStoreOrderDetail = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/crossStoreSuborderOrder/detail"),
    { params }
  );
};

/** 取消 */
export const cancelCrossStoreOrder = (data?: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/crossStoreSuborderOrder/cancel"),
    { data }
  );
};

/** 确认 */
export const confirmCrossStoreOrder = (data?: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/crossStoreSuborderOrder/verify"),
    { data }
  );
};

/** 跨店销售订单平台端操作通过/驳回 */
export const upCrossStoreOrderStatus = (data?: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/crossStoreSuborderOrder/plat/operate"),
    {
      data
    }
  );
};
